﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.Linq;
using System.Text;
using Flora.Common;
using QLKHO.MODEL;

namespace QLKHO.BL
{
    public class UserBL
    {
        private static EntityBL _entityBL = new EntityBL();
        public static EntityBL entityBL
        {
            get
            {
                _entityBL = new EntityBL();
                _entityBL.CreateDataContext += new EntityBL.CreateDataContextHandler(entityBL_CreateDataContext);
                return _entityBL;
            }
        }
        private static DataContext entityBL_CreateDataContext()
        {
            return new QLKHO.MODEL.Model.QLKHODataContext();
        }
        public static Boolean CheckLogin(string userName,string passWord)
        {
            try
            {
                List<MODEL.Model.VT_NGUOIDUNG> checkLogin = entityBL.GetEntityList<MODEL.Model.VT_NGUOIDUNG>(item => item.TenDangNhap == userName && item.MatKhau == passWord).ToList();
                if (checkLogin.Count > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
